package com.learn.actionplatfo.controller;

import com.learn.actionplatfo.bean.User;
import com.learn.actionplatfo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/userListJson")
    @ResponseBody
    public String userListJson(){
        return userService.selectAll().toString();
    }

    @RequestMapping("/helloUser")
    public String hello(Model model){
        model.addAttribute("msg","Hello");
        return "hello";
    }

    @RequestMapping("/login")
    public String login(){return "login";}
}